package com.ocelot.san.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import com.ocelot.san.dto.Notary;
import com.ocelot.san.repository.NotaryRepository;

@Service
public class NotaryService {
	
	@Resource
	private NotaryRepository notaryRepository;
	
	public void save(Notary notary) {
		notaryRepository.save(notary);
	}
	
	public Notary findById(Long id) {
		return notaryRepository.findOne(id);
	}

	public void delete(Long id) {
		notaryRepository.delete(id);
	}

	
	public List<Notary> fetchAll() {
		return notaryRepository.findAll(new Sort(Sort.Direction.ASC, "name"));
	}

}
